package com.agua.enturno.servicios.impl;

import com.agua.enturno.modelo.agenda.DiaNoLaboral;
import com.agua.enturno.persistencia.dao.DiaNoLaboralDAO;
import com.agua.enturno.servicios.DiaNoLaboralService;
import com.agua.enturno.vista.dto.DiaNoLaboralDTO;
import com.agua.enturno.vista.dto.HorarioDTO;
import com.agua.enturno.vista.dto.assemblers.DiaNoLaboralAssembler;
import com.agua.enturno.vista.dto.assemblers.HorarioAssembler;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public class DiaNoLaboralServiceImpl implements DiaNoLaboralService {

	private DiaNoLaboralDAO diaNoLaboralDAO;
	private DiaNoLaboralAssembler diaNoLaboralAssembler;
	private HorarioAssembler horarioAssembler;
	
	
	/*------------------------------------ Public methods ----------------------------------*/
	
	@Override
	@Transactional
	public DiaNoLaboralDTO findById(Long id) {
		return diaNoLaboralAssembler.assemble(diaNoLaboralDAO.findById(id));
	}
	
	@Override
	@Transactional
	public List<HorarioDTO> findHorarios(Long diaNoLaboralId) {
		DiaNoLaboral diaNoLaboral = diaNoLaboralDAO.findById(diaNoLaboralId);
		return horarioAssembler.assemble(diaNoLaboral.getHorarios());
	}

	/*--------------------------------------------------------------------------------------*/
	/*---------------------------------- Geters and seters ---------------------------------*/
	
	public void setDiaNoLaboralDAO(DiaNoLaboralDAO diaNoLaboralDAO) {
		this.diaNoLaboralDAO = diaNoLaboralDAO;
	}
	
	public void setDiaNoLaboralAssembler(DiaNoLaboralAssembler diaNoLaboralAssembler) {
		this.diaNoLaboralAssembler = diaNoLaboralAssembler;
	}
	
	public void setHorarioAssembler(HorarioAssembler horarioAssembler) {
		this.horarioAssembler = horarioAssembler;
	}

	/*--------------------------------------------------------------------------------------*/
	
}
